FROM python
#:slim

#ENV LANG en_US.UTF-8
#ENV LC_ALL en_US.UTF-8
#WORKDIR /
RUN  sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list; \
     sed -i s@/security.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list; \
     apt-get clean && apt-get update; \
     apt-get install -y python3-pip \
                        sshpass \
                        vim \
                        net-tools \
                        iputils-ping; \
     python3 -m pip install ansible==2.10.6 -i  https://pypi.tuna.tsinghua.edu.cn/simple/; \
     rm -rf /root/.cache/pip && apt-get clean 
#&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN mkdir /ansible && \
    mkdir -p /etc/ansible && \
    echo 'localhost' > /etc/ansible/hosts && \
    echo [defaultes] > /etc/ansible/ansible.cfg && \
    echo host_key_checking = False >> /etc/ansible/ansible.cfg


WORKDIR /ansible

#ENTRYPOINT ["ansible-playbook"]
ENV ANSIBLE_HOST_KEY_CHECKING=False

CMD [ "ansible", "--version" ]
